package com.zcxx.cotton.pick.task;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.config.ApiConfig;
import com.ruoyi.common.config.TaskConfig;
import com.ruoyi.common.utils.http.SendUtils;
import com.zcxx.cotton.base.domain.PubPickerDevice;
import com.zcxx.cotton.base.service.IPubPickerDeviceService;
import com.zcxx.cotton.pick.domain.*;
import com.zcxx.cotton.pick.mapper.PickMapElementMapper;
import com.zcxx.cotton.pick.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;


@Component("PickMapTask")
public class PickMapTask {


    @Autowired
    private IPickMapElementService pickMapElementService;

    public void doTask(String tableName){
        List<PickMapElement> pickMapElements = pickMapElementService.selectAll(tableName,null);
        for (PickMapElement pickMapElement : pickMapElements) {
            if (pickMapElement.getDetail()!= null){
                Double area = pickMapElementService.getArea(pickMapElement.getDetail());
                pickMapElement.setArea(area);
            }
        }
        pickMapElementService.batchUpdate(pickMapElements,tableName);


    }
}
